﻿<%@ Page  Language="C#" MasterPageFile="~/NewMasterPages/nMember.master" AutoEventWireup="true" CodeBehind="quxian.aspx.cs" Inherits="map.member.money.quxian" Title="提现申请" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../../outstyle.css" rel="stylesheet" type="text/css" />
    <script src="../../js/dropdowncontent.js" type="text/javascript"></script>
    <style type ="text/css">
        .MainContentDiv
        {
            width:95%;
            margin:10px 5px 10px 5px;
        }
        .withDrawDiv
        {
        	border:solid 1px #FFCC33;
         }
         .withDrawTable
         {
         	border:solid 7px #FFF4C2;
         	padding:3px 3px 3px 3px;
         	width:100%;
         	height:100%;
         }
         .td_w_0
         {
         	width:30%;
         	text-align:right ;
         	vertical-align:top ;
         	padding:2px 0px 2px 0px;
         }
         .td_w_1
         {
         	width:70%;
         	text-align:left  ;
         	vertical-align:top ;
         	padding:2px 0px 2px 0px;
         }
         .detailTable
         {
         	vertical-align:top ;
         }
          .SubmitCharge
        {
            background:url(/img/btnTmp_orange.png) no-repeat 0px 0px;
            border:none;
            text-align:center;
            padding-left:20px;
            font-weight:bold ;
            cursor:pointer ;
            width:82px;
            height:34px;
        }
        .td_w_1 span
        {
            color:Blue;
        }
        .MainContentDiv a
        {
            color:Blue;
        }          
        .validateErrorMsg
        {
            background:url(/img/errorMsg.ico) no-repeat ;
            padding-left:20px;
            border:solid 1px red;
            font-size:smaller;
            padding:2px 2px 2px 20px;
            color:Red;
        }
        .withDrawDiv h1
        {
            font-size:medium  ;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form action="WithDrawResult.aspx" method="post" onsubmit="return submitWithDraw();">    
        <div id="MainContentDiv" class="MainContentDiv">
            <h1 style=" padding-left:20px; margin-bottom:4px; font-size:large ;">申请提现&nbsp;&nbsp;&nbsp;&nbsp;<a  href="WithDrawRecord.aspx" target="_blank" style="  font-size:small ;color:Red; font-weight:normal; text-decoration:underline ">点此查看提现记录</a></h1>
            <hr  /><br/>
            <div id="BankInfoErrorDiv" style=" height:30px; line-height:30px; padding-left:20px; display :none">
                <span class="validateErrorMsg">银行账户信息不完整，请补充账户信息后再申请提现！</span> 
                <a href="">补充银行账户信息</a>
            </div>
            <div class ="withDrawDiv" >
                <table class="withDrawTable" width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td style=" vertical-align:top; padding:5px 5px 5px 5px; width:55%">
                            <h1>您的帐户信息：</h1>
                            <span>&nbsp;</span>
                            <hr  style=" margin-bottom:5px; margin-top:2px;color:Gray;"/>
                            <table class ="detailTable" width="100%" cellpadding="0" cellspacing ="0">
                                <tr>
                                    <td class="td_w_0">
                                        真实姓名：
                                    </td>
                                    <td class="td_w_1">
                                        <span  ><%= user.cbname.Value  %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        网站ID：
                                    </td>
                                    <td class="td_w_1">
                                        <span id="curuserid0"  ><%= user.cbuserid.Value  %></span>
                                        <input name="curuserid"  id="curuserid" type="hidden"  value ='<%= user.cbuserid.Value  %>' />
                                    </td>
                                </tr>
                                 <tr>
                                    <td class="td_w_0">
                                        提现金额：
                                    </td>
                                    <td class="td_w_1">
                                        <input  title="提现金额必须小于可提现的总额" type="text" value=""  name="withDrawAmount" id="withDrawAmount"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0" style=" padding:4px 0px 4px 0px;">
                                        &nbsp;
                                    </td>
                                    <td class="td_w_1" style=" padding:4px 0px 4px 0px;">
                                        <span style=" font-size:small;">当前可提现金额：<label  id="totalAmountLabel"  style="color:Red ; font-size:small;"><%= user.cbmoney.ToString () %></label> 元</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        支付密码：
                                    </td>
                                    <td class="td_w_1"> 
                                        <input  type="password" id="password" name="password"  value =""/>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        &nbsp;
                                    </td>
                                    <td class="td_w_1" style=" text-align:right; padding-top:10px;">
                                        <input  type="submit"  title="申请提现" value ="下一步" class ="SubmitCharge"/>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style=" width:10%;">
                            <div style=" background:url(/img/reinput_bg.gif) no-repeat -350px 0px; width:100%; height:250px "> &nbsp;
                            </div>
                        </td>
                        <td style=" vertical-align:top;  padding:5px 5px 5px 5px; width:35%">
                            <h1>银行帐号信息：</h1>
                            <span style=" color:blue;"> ( <a target="_blank" href="ChangeBankInfo.aspx?type=0">更换银行账号</a> <a id="deleteBankInfo" runat="server" onclick ="return confirm('您确定要删除该银行账号吗？');"  onserverclick ="deleteBankInfo_ServerClick" href="#">删除银行账号</a> ) </span>
                            <hr  style=" margin-bottom:5px; margin-top:2px;color:Gray;"/>
                            <table class="detailTable" width="100%" cellpadding="0" cellspacing ="0">
                                <tr>
                                    <td class="td_w_0">
                                        开户名：
                                    </td>
                                    <td class="td_w_1">
                                        <span  id="BankAccountNameSpan"><%= user.BankAccountName  .Value  %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        银行帐号：
                                    </td>
                                    <td class="td_w_1">
                                        <span  id="AccountNumberSpan" ><%= GetAccountNumber() %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        开户银行名称：
                                    </td>
                                    <td class="td_w_1">
                                        <span  id="BankNameSpan"><%= user.BankName .Value  %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        支行名称：
                                    </td>
                                    <td class="td_w_1">
                                        <span  id="BankBranchNameSpan"><%= user.BankBranchName  .Value  %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_w_0">
                                        帐户类型：
                                    </td>
                                    <td class="td_w_1">
                                        <span id="BankAccountTypeSpan"><%= (user.BankAccountType .Value ==RuleCode .Enum .BankAccountType .CompanyAccount )?"公司账户":"个人账户" %></span>
                                    </td>
                                </tr>                             
                            </table>
                            <div style="border:solid 1px lightBlue;  width:80%;  padding:4px 4px 4px 4px; margin:15px 5px 5px 5px;">
                                <span style="  color:Red; font-size:small;">
                                请仔细核对您提现要转入的银行账号，申请提现后，资金将冻结，并且不可取消！
                                </span>
                            </div>
                        </td>
                    </tr> 
                </table>
            </div>
            
            <%--<div style=" margin:15px 0px 0px 10px; text-align:right;">
                <a target="_blank" href ="WithDrawRecord.aspx">点此查看提现记录</a>
            </div>--%>
        </div>

        <script src="../../js/PageValidateUtil.js" type="text/javascript"></script>
        <script type="text/javascript">
            function submitWithDraw() {
                var errorCount = PageValidateUtil.initImidValidates(["CustomerValidate", "CustomerValidate"], [
                            ["withDrawAmount", validateAmount, "提现金额应该为有效值(保留两位小数)", "validateErrorMsg", 1],
                            ["password", validatePassword, "密码不正确", "validateErrorMsg", 1]]);
                var bankInfo = validateBankInfo();

                return (errorCount <= 0 && bankInfo==true );
            }


            function validateBankInfo() {
                var result = true;
                var allBankInfoSpanIdList = ["BankAccountTypeSpan", "BankBranchNameSpan", "BankNameSpan", "AccountNumberSpan", "BankAccountNameSpan"];
                for (var i = 0; i < allBankInfoSpanIdList.length; i++) {
                    var spanEle = document.getElementById(allBankInfoSpanIdList[i]);
                    if (spanEle.innerHTML == "") {
                        result = false;
                        break;
                    }
                }
                var BankInfoErrorDiv = document.getElementById("BankInfoErrorDiv");
                BankInfoErrorDiv.style.display = (result == true) ? "none" : "block";
                return result;
            }
            PageValidateUtil.initFocusValidates(["CustomerValidate", "CustomerValidate"], [
                            ["withDrawAmount", validateAmount, "提现金额应该为有效值(保留两位小数)", "validateErrorMsg", 2],
                            ["password", validatePassword, "密码不正确", "validateErrorMsg", 2]]);

            function validateAmount() {
                var withDrawAmount = document.getElementById("withDrawAmount").value;
                var amountRegex = /^[1-9]([0-9]{0,3})$|^[1-9]([0-9]{0,3})\.([0-9]{1,2})$|^0\.([0-9][1-9]|([1-9]0)|[1-9])$/;
                if (amountRegex.test(withDrawAmount)) {
                    var amount = parseFloat(withDrawAmount);
                    var totalAmountStr = document.getElementById("totalAmountLabel").innerHTML;
                    var totalAmount = (totalAmountStr == "") ? 0 : (parseFloat(totalAmountStr));
                    return  (amount <= totalAmount);                    
                }
                else {
                    return false;
                }
            }
            function validatePassword() {
                var userid = document.getElementById("curuserid0").innerHTML;
                var password = document.getElementById("password").value;
                var result = AjaxFunction.ValidatePassword(userid, password);
                if (result.value != null && result.value == true)
                    return true;
                return false;
            }
        </script>
    </form>
</asp:Content>
